package SortMethod;

import SortHelper.SortHelper;

//感觉插入排序快忘记了，赶快重复一遍
public class InsertSortSecond {

    private InsertSortSecond(){}

    public static <E extends Comparable<E>> void sort(E[] arr){
        for (int i = 1; i < arr.length; i++) {
            for (int j = i; j > 0; j--) {
                if (arr[j].compareTo(arr[j - 1]) < 0)
                    SortHelper.swap(arr,j,j - 1);
                else break;
            }
        }
    }
}
